package tt.dz.service.imp.base;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import tt.dz.dao.base.OmsCommonDao;
import tt.dz.entity.base.JsonForList;
import tt.dz.entity.base.OmsCommonParam;
import tt.dz.entity.base.OmsPubOperCommend;
import tt.dz.service.base.PubOperCommendService;
@Service @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class PubOperCommendServiceImpl extends BaseService implements PubOperCommendService{
	@Autowired
	@Qualifier("base")
	private OmsCommonDao<OmsPubOperCommend> omsCommonDaoImpl;
	

	@Override
	public JsonForList<?> findPageObjs(OmsCommonParam param, OmsPubOperCommend pubOperCommend) 
	{
		try 
		{
			List<OmsPubOperCommend> lst = omsCommonDaoImpl.pagingFind(param, pubOperCommend);
			int total = 0;
			if (param.isQueryTotal())
			{
				total = omsCommonDaoImpl.queryTotalByObject(pubOperCommend);
			}
			return this.buildSuccessJsonForList(param, lst, total);
		} catch (Exception e) {
			this.logError(e.getMessage(), e);
			return this.buildError400JsonForList();
		}
	}

}
